package com.gewu.bluetoothflow.service

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Message
import com.gewu.bluetoothflow.MyApp.Companion.ACTION_SEND_DATA
import com.gewu.bluetoothflow.MyApp.Companion.EXTRA_DATA

class DataRefreshReceiver(var message: Messages): BroadcastReceiver() {
  //  var message: Messages? = null
    override fun onReceive(p0: Context?, p1: Intent?) {
       if (p1!!.action.equals(ACTION_SEND_DATA)) {
           val data = p1.getStringExtra(EXTRA_DATA)
           if (message != null) {
               message!!.getMsg(data!!)
           }
       }
    }

    interface Messages{
        fun getMsg(str:String)
    }

//    fun setMessage(msg:Messages){
//        this.message = msg
//    }

}